let timer: any = null;
export const debounce = (fn: Function, time: number, immediate: Boolean = true) => {
  if (timer) return;
  immediate ? fn() : '';
  timer = setTimeout(() => {
    fn();
    timer = null;
  }, time);
};
